package com.shop2cn.iapi.agentproducts.testcase;

import java.awt.AWTException;
import java.awt.Color;
import java.awt.Font;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.io.File;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.AgentPricePo;
import com.shop2cn.iapi.agentproducts.parameter.ImportAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.ModifyAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.ModifyCatalogDto;
import com.shop2cn.iapi.agentproducts.parameter.PriceModel;
import com.shop2cn.iapi.agentproducts.parameter.ProductCatalogListDto;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsBean;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsDto;
import com.shop2cn.iapi.agentproducts.parameter.ProductListDto;
import com.shop2cn.iapi.agentproducts.parameter.SubCatalogDto;
import com.shop2cn.iapi.agentproducts.service.ProductDetailsCall;
import com.shop2cn.iapi.agentproducts.service.ProductDetailsCallV2;
import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateCollectionGoodsAddressBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateFreightTemplateBean;
import com.ymatou.iapi.godmch.parameter.CreateCodeBean;
import com.ymatou.iapi.godmch.parameter.createDepotBean;
import com.ymatou.iapi.godmch.parameter.createmchBean;
import com.ymatou.iapi.godmch.parameter.setAgentConditionMarkupConfigBean;
import com.ymatou.iapi.godmch.parameter.setConditionMarkupConfigBean;
import com.ymatou.iapi.godmch.service.CreateCodeCall;
import com.ymatou.iapi.godmch.service.setAgentConditionMarkupConfigCall;
import com.ymatou.iapi.prodstock.parameter.AgentProductPo;
import com.ymatou.iapi.sellerproduct.parameter.ESsearchBean;
import com.ymatou.iapi.sellerproduct.service.ESsearchCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AddAgentProductCallService;
import com.ymttest.business.service.AgentProductCallService;
import com.ymttest.business.service.DGUserCallService;
import com.ymttest.business.service.GodfreightmgrService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.YmtCatalogsI;
import com.ymttest.database.model.YmtProductsI;
import com.ymttest.database.model.mch_relation;
import com.ymttest.database.model.godmch.mch_depot_info;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.database.sqlwapper.godmch.mch_relationWapper;
import com.ymttest.utils.AgentUsers;
import com.ymttest.utils.FontImage;
import com.ymttest.utils.MapUtil;
import com.ymttest.utils.TestDataManager;

/**
 * 商品详情 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_ProductDetails {
	private static ProductDetailsBean productdetailsBean;
	private static ProductDetailsCall productdetailsCall;
	private static YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
	private static YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();

//	渠道商
	private static int sellerId = AgentUsers.rootUserId;
	private static String sellerName = "NickautoTest";
	
	// 渠道商
	private static int rootUserId = AgentUsers.rootUserId;
	private static String rootUserName = "NickautoTest";
	// 渠道商->代理商1
	private static int agentUserId1 = AgentUsers.agentUserId1;
	private static String agentUserName1 = "NickautoTest";
	// 渠道商->代理商2
	private static int agentUserId2 = AgentUsers.agentUserId2;
	private static String agentUserName2 = "NickautoTest";

	// vip渠道
	private static int vipRootUserId = AgentUsers.vipRootUserId;
	private static String vipRootUserName = "NickautoTest";
	private static int csId = AgentUsers.csId;
	// vip渠道->代理
	private static int vipAgentUserId1 = AgentUsers.vipAgentUserId1;
	private static String vipAgentUserName1 = "dgsq408897016";
	private static int csId1 = AgentUsers.csId1;
	// vip渠道->代理->代理
	private static int vipAgentUserId2 = AgentUsers.vipAgentUserId2;
	private static String vipAgentUserName2 = "NickautoTest";

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("商品详情");
	}

	@Before
	public void caseUp() {
		productdetailsBean = new ProductDetailsBean();
		productdetailsCall = new ProductDetailsCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(productdetailsCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	// 渠道商查看自己的商品
	public void verifyRootCatalog(ProductDetailsDto productDetailsDto, boolean isAgentUser)
			throws InterruptedException {
		productDetailsDto.getCatalogList().forEach(p -> {
			if (p.getCatalogId() != null) {
				try {
					YmtCatalogsI ymtCatalogsI = ymtCatalogsIWapper.selectCatalogsByCatalogId(p.getCatalogId());
					Logger.verifyEquals(p.getDirectPrice(), ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue(),
							"验证directPrice");
					List<Map> maps = ymtCatalogsIWapper.selectCatalogSetAttributesByCatalogId(p.getCatalogId());
					List<String> sCategoryAttribute = maps.stream().map(o -> o.get("sCategoryAttribute").toString())
							.collect(Collectors.toList());
					String s = sCategoryAttribute.get(0);
					for (int i = 1; i < sCategoryAttribute.size(); i++) {
						s = s + " + " + sCategoryAttribute.get(i);
					}
					
					Logger.verifyEquals(p.getPropertyValue(), s, "验证propertyValue");
					Logger.verifyEquals(p.isMissedCatalog(), false, "验证missedCatalog");
					Logger.verifyEquals(p.getSku(), ymtCatalogsI.getsSKU(), "验证sku");
					if (!isAgentUser) {
						Logger.verifyEquals(p.getParentCatalogId(), null, "验证parentCatalogId");
						Logger.verifyEquals(p.getStockInfo(), "库存 " + ymtCatalogsI.getiNum(), "验证stockInfo");
						Logger.verifyEquals(p.getAgentPrice(), 0.0, "验证agentPrice");
						Logger.verifyEquals(p.getWeight(), ymtCatalogsI.getWeight().setScale(1).doubleValue(),
								"验证Weight");
						Logger.verifyEquals(p.getStock(), ymtCatalogsI.getiNum(), "验证stock");
						Logger.verifyEquals(p.getProfit(), 0.0, "验证profit");
					} else {

						Logger.verifyEquals(p.getParentCatalogId(), ymtCatalogsI.getParentCatalogId(),
								"验证parentCatalogId");
						YmtCatalogsI ymtCatalogsI1 = ymtCatalogsIWapper
								.selectCatalogsByCatalogId(ymtCatalogsI.getRootCatalogId());
						if (ymtCatalogsI1.getiNum() < 10) {
							Logger.verifyEquals(p.getStockInfo(), "库存紧张(不足10件)", "验证stockInfo");
						} else {
							Logger.verifyEquals(p.getStockInfo(), "库存充足", "验证stockInfo");
						}
						List<PriceModel> priceModels = ymtProductsIWapper.selectAgentProductPrice(p.getCatalogId());

						Logger.verifyEquals(p.getAgentPrice(), priceModels.get(0).getBuyingPrice(), "验证agentPrice");
						double agentPrice = priceModels.get(0).getBuyingPrice();

						// Logger.verifyEquals(p.getStock(), 0, "验证stock");

						if (p.getProfit() != 0) {
							Logger.verifyEquals(p.getProfit(),
									ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue() - agentPrice, "验证profit");
						}
					}

				} catch (InterruptedException e) {
					e.printStackTrace();
				}

			} else {
				try {
					YmtCatalogsI ymtCatalogsI = ymtCatalogsIWapper.selectCatalogsByCatalogId(p.getParentCatalogId());
					Logger.verifyEquals(p.getDirectPrice(), 0.0, "验证directPrice");
					Logger.verifyEquals(p.getAdvicePrice(), ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue(),
							"验证advicePrice");
					List<Map> maps = ymtCatalogsIWapper.selectCatalogSetAttributesByCatalogId(p.getCatalogId());
					List<String> sCategoryAttribute = maps.stream().map(o -> o.get("sCategoryAttribute").toString())
							.collect(Collectors.toList());
					String s = sCategoryAttribute.get(0);
					for (int i = 11; i < sCategoryAttribute.size(); i++) {
						s = s + " + " + sCategoryAttribute.get(i);
					}
					Logger.verifyEquals(p.getPropertyValue(), s, "验证propertyValue");
					Logger.verifyEquals(p.isMissedCatalog(), true, "验证missedCatalog");
					Logger.verifyEquals(p.getSku(), null, "验证sku");
					Logger.verifyEquals(p.getCatalogId(), null, "验证CatalogId");
					Logger.verifyEquals(p.getStockInfo(), null, "验证stockInfo");
					Logger.verifyEquals(p.getWeight(), 0.0, "验证Weight");
					// Logger.verifyEquals(p.getStock(), 0, "验证stock");
					Logger.verifyEquals(p.getProfit(), 0.0, "验证profit");

					mch_relationWapper mchRelationWapper = new mch_relationWapper();
					List<mch_relation> mchRelations = mchRelationWapper
							.selectby(MapUtil.hashMap("mchId", productdetailsBean.getUserId()));
					List<AgentPricePo> agentPricePos = ymtProductsIWapper.selectAgentPriceByCatalogIdAndAgentType(
							ymtCatalogsI.getsCatalogId(), mchRelations.get(0).getAgentType());
					if (!agentPricePos.isEmpty()) {
						Logger.verifyEquals(p.getAgentPrice(), agentPricePos.get(0).getAgentPrice(), "验证agentPrice");
					} else {
						Logger.verifyEquals(p.getAgentPrice(), ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue(),
								"验证agentPrice");
					}
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		});
	}

	// 下级代理查看上级渠道商规格验证
	public void verifyRootCatalogV2(ProductDetailsDto productDetailsDto, ProductDetailsBean productdetailsBean)
			throws InterruptedException {
		productDetailsDto.getCatalogList().forEach(p -> {
			if (p.getCatalogId() != null) {
				try {
					YmtCatalogsI ymtCatalogsI = ymtCatalogsIWapper.selectCatalogsByCatalogId(p.getCatalogId());
					YmtCatalogsI ymtCatalogsI1 = ymtCatalogsIWapper
							.selectCatalogsByCatalogId(ymtCatalogsI.getRootCatalogId());
					Logger.verifyEquals(p.getDirectPrice(), 0.0, "验证directPrice");
					if (p.getParentCatalogId() != null) {
						Logger.verifyEquals(p.getParentCatalogId(), ymtCatalogsI.getParentCatalogId(),
								"验证parentCatalogId");
					} else {
						Logger.verifyEquals(p.getParentCatalogId(), null, "验证parentCatalogId");
					}

					Logger.verifyEquals(p.getAdvicePrice(), ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue(),
							"验证advicePrice");
					List<Map> maps = ymtCatalogsIWapper.selectCatalogSetAttributesByCatalogId(p.getCatalogId());
					List<String> sCategoryAttribute = maps.stream().map(o -> o.get("sCategoryAttribute").toString())
							.collect(Collectors.toList());
					String s = sCategoryAttribute.get(0);
					for (int i = 1; i < sCategoryAttribute.size(); i++) {
						s = s + " + " + sCategoryAttribute.get(i);
					}
					Logger.verifyEquals(p.getPropertyValue(), s, "验证propertyValue");
					if (ymtCatalogsI1.getiNum() > 10) {
						Logger.verifyEquals(p.getStockInfo(), "库存充足", "验证stockInfo");
					} else {
						Logger.verifyEquals(p.getStockInfo(), "库存紧张(不足10件)", "验证stockInfo");
					}
					Logger.verifyEquals(p.isMissedCatalog(), false, "验证missedCatalog");
					// Logger.verifyEquals(p.getStock(), 0, "验证stock");
					Logger.verifyEquals(p.getSku(), ymtCatalogsI.getsSKU(), "验证sku");

					mch_relationWapper mchRelationWapper = new mch_relationWapper();
					List<mch_relation> mchRelations = mchRelationWapper
							.selectby(MapUtil.hashMap("mchId", productdetailsBean.getUserId()));
					AgentPricePo agentPricePo = ymtProductsIWapper.selectAgentPriceByCatalogIdAndAgentType(
							p.getCatalogId(), mchRelations.get(0).getAgentType()).get(0);

					Logger.verifyEquals(p.getAgentPrice(), agentPricePo.getAgentPrice(), "验证agentPrice");
					// Logger.verifyEquals(p.getProfit(), 0.0, "验证profit");
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		});
	}

	// 继承直销价 下级看上级
	public void verifyRootCatalogV3(ProductDetailsDto productDetailsDto) throws InterruptedException {
		productDetailsDto.getCatalogList().forEach(p -> {
			try {
				YmtCatalogsI ymtCatalogsI = ymtCatalogsIWapper.selectCatalogsByCatalogId(p.getCatalogId());
				YmtCatalogsI ymtCatalogsI1 = ymtCatalogsIWapper
						.selectCatalogsByCatalogId(ymtCatalogsI.getRootCatalogId());
				if (ymtCatalogsI.getParentCatalogId() != null) {
					Logger.verifyEquals(p.getParentCatalogId(), ymtCatalogsI.getParentCatalogId(), "验证parentCatalogId");
				} else {
					Logger.verifyEquals(p.getParentCatalogId(), null, "验证parentCatalogId");
				}
				Logger.verifyEquals(p.getDirectPrice(), 0.0, "验证directPrice");
				Logger.verifyEquals(p.getAgentPrice(), ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue(),
						"验证advicePrice");
				Logger.verifyEquals(p.getAdvicePrice(), ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue(),
						"验证agentPrice");
				Logger.verifyEquals(p.isMissedCatalog(), false, "验证missedCatalog");
				// Logger.verifyEquals(p.getStock(), 0, "验证stock");
				Logger.verifyEquals(p.getProfit(), 0.0, "验证profit");
				Logger.verifyEquals(p.getSku(), ymtCatalogsI.getsSKU(), "验证sku");

				if (ymtCatalogsI1.getiNum() < 10) {
					Logger.verifyEquals(p.getStockInfo(), "库存紧张(不足10件)", "验证stockInfo");
				} else {
					Logger.verifyEquals(p.getStockInfo(), "库存充足", "验证stockInfo");
				}
				List<Map> maps = ymtCatalogsIWapper.selectCatalogSetAttributesByCatalogId(p.getCatalogId());
				List<String> sCategoryAttribute = maps.stream().map(o -> o.get("sCategoryAttribute").toString())
						.collect(Collectors.toList());
				String s = sCategoryAttribute.get(0);
				for (int i = 1; i < sCategoryAttribute.size(); i++) {
					s = s + " + " + sCategoryAttribute.get(i);
				}
				Logger.verifyEquals(p.getPropertyValue(), s, "验证propertyValue");
			} catch (InterruptedException e) {
				e.printStackTrace();
			}

		});

	}

	// 继承直销价 自己看自己
	public void verifyRootCatalogV4(ProductDetailsDto productDetailsDto) throws InterruptedException {
		productDetailsDto.getCatalogList().forEach(p -> {
			try {
				YmtCatalogsI ymtCatalogsI = ymtCatalogsIWapper.selectCatalogsByCatalogId(p.getCatalogId());
				YmtCatalogsI ymtCatalogsI1 = ymtCatalogsIWapper
						.selectCatalogsByCatalogId(ymtCatalogsI.getRootCatalogId());
				YmtCatalogsI ymtCatalogsI2 = ymtCatalogsIWapper
						.selectCatalogsByCatalogId(ymtCatalogsI.getParentCatalogId());
				if (ymtCatalogsI.getParentCatalogId() != null) {
					Logger.verifyEquals(p.getParentCatalogId(), ymtCatalogsI.getParentCatalogId(), "验证parentCatalogId");
				} else {
					Logger.verifyEquals(p.getParentCatalogId(), null, "验证parentCatalogId");
				}
				Logger.verifyEquals(p.getDirectPrice(), ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue(),
						"验证directPrice");
				Logger.verifyEquals(p.getAgentPrice(), ymtCatalogsI2.getfQuotePrice().setScale(1).doubleValue(),
						"验证agentPrice");
				Logger.verifyEquals(p.isMissedCatalog(), false, "验证missedCatalog");
				// Logger.verifyEquals(p.getStock(), 0, "验证stock");
				Logger.verifyEquals(p.getProfit(), ymtCatalogsI.getfQuotePrice().setScale(1).doubleValue()
						- ymtCatalogsI2.getfQuotePrice().setScale(1).doubleValue(), "验证profit");
				Logger.verifyEquals(p.getSku(), ymtCatalogsI.getsSKU(), "验证sku");

				if (ymtCatalogsI1.getiNum() < 10) {
					Logger.verifyEquals(p.getStockInfo(), "库存紧张(不足10件)", "验证stockInfo");
				} else {
					Logger.verifyEquals(p.getStockInfo(), "库存充足", "验证stockInfo");
				}
				List<Map> maps = ymtCatalogsIWapper.selectCatalogSetAttributesByCatalogId(p.getCatalogId());
				List<String> sCategoryAttribute = maps.stream().map(o -> o.get("sCategoryAttribute").toString())
						.collect(Collectors.toList());
				String s = sCategoryAttribute.get(0);
				for (int i = 1; i < sCategoryAttribute.size(); i++) {
					s = s + " + " + sCategoryAttribute.get(i);
				}
				Logger.verifyEquals(p.getPropertyValue(), s, "验证propertyValue");

			} catch (InterruptedException e) {
				e.printStackTrace();
			}

		});

	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_01() {
		Logger.start(true, "渠道商查看自己的商品详情，获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, rootUserId, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_0101() {
		Logger.start(true, "渠道商查看自己的商品详情，买家端店铺首页中不可见,获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			addAgentProductBean.setInvisible(false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, rootUserId, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_011() {
		Logger.start(true, "渠道商查看自己的商品详情，没有设置代理价,获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, rootUserId, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			// AgentProductCallService.checkProductDetail(productId,productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_04() {
		Logger.start(true, "vip渠道->vip1->vip2,vip1查看vip1商品详情，获取成功");
		try {

			// 发布商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					agentProductId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, true);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_05() {
		Logger.start(true, "vip渠道->vip1->vip2,vip2查看vip2商品详情，获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId2, vipAgentUserId2,
					agentProductId1, true);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId1, productDetailsDto);
			verifyRootCatalog(productDetailsDto, true);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_061() {
		Logger.start(true, "vip渠道->vip1代理，vip1导入vip渠道商品,vip渠道新增规格，vip1查看已经导入的vip渠道商品,showAllCatalog为false，无新增规格信息");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip1导入渠道商商品
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ModifyAgentProductBean modifyAgentProductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);

			// 新增规格
			ModifyCatalogDto catalogDto = new ModifyCatalogDto();
			catalogDto.setDirectPrice(110);
			catalogDto.setStock(110);
			catalogDto.setSku(modifyAgentProductBean.getCatalogList().get(0).getSku());
			catalogDto.setOperateType(0);
			catalogDto.setPropertyValue("新增规格" + TestDataManager.getRandomNum(6));
			catalogDto.setAgentPriceList(modifyAgentProductBean.getCatalogList().get(0).getAgentPriceList());
			modifyAgentProductBean.getCatalogList().add(catalogDto);

			AddAgentProductCallService.modifyAgentProduct(modifyAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					agentProductId, false);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, true);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_062() {
		Logger.start(true, "vip渠道->vip1代理，vip1导入vip渠道商品,vip渠道新增规格，vip1查看已经导入的vip渠道商品,showAllCatalog为true，有新增规格信息");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip1导入渠道商商品
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ModifyAgentProductBean modifyAgentProductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);

			// 新增规格
			ModifyCatalogDto catalogDto = new ModifyCatalogDto();
			catalogDto.setDirectPrice(110);
			catalogDto.setStock(110);
			catalogDto.setSku(modifyAgentProductBean.getCatalogList().get(0).getSku());
			catalogDto.setOperateType(0);
			catalogDto.setPropertyValue("新增规格" + TestDataManager.getRandomNum(6));
			catalogDto.setAgentPriceList(modifyAgentProductBean.getCatalogList().get(0).getAgentPriceList());
			modifyAgentProductBean.getCatalogList().add(catalogDto);

			AddAgentProductCallService.modifyAgentProduct(modifyAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					agentProductId, true);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, true);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_02() {
		Logger.start(true, "普通代理查看上级渠道商商品，获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, agentUserId1, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalogV2(productDetailsDto, productdetailsBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_03() {
		Logger.start(true, "vip渠道->vip1->vip2,vip2查看vip1商品详情，获取成功");
		try {
			// 发布商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId2,
					agentProductId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalogV2(productDetailsDto, productdetailsBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_06() {
		Logger.start(true, "vip渠道->vip1代理，vip渠道新增规格，vip1获取vip渠道商品详情，获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ModifyAgentProductBean modifyAgentProductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);

			// 新增规格
			ModifyCatalogDto catalogDto = new ModifyCatalogDto();
			catalogDto.setDirectPrice(110);
			catalogDto.setStock(110);
			catalogDto.setSku(modifyAgentProductBean.getCatalogList().get(0).getSku());
			catalogDto.setOperateType(0);
			catalogDto.setPropertyValue("新增规格" + TestDataManager.getRandomNum(6));
			catalogDto.setAgentPriceList(modifyAgentProductBean.getCatalogList().get(0).getAgentPriceList());
			modifyAgentProductBean.getCatalogList().add(catalogDto);

			AddAgentProductCallService.modifyAgentProduct(modifyAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipAgentUserId1,
					productId, false);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalogV2(productDetailsDto, productdetailsBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_07() {
		Logger.start(true, "vip渠道->vip1代理，vip渠道删除规格，vip1获取vip渠道商品详情");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ModifyAgentProductBean modifyAgentProductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);

			// 删除规格
			modifyAgentProductBean.getCatalogList().get(0).setOperateType(2);

			AddAgentProductCallService.modifyAgentProduct(modifyAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipAgentUserId1,
					productId, true);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalogV2(productDetailsDto, productdetailsBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_08() {
		Logger.start(true, "vip渠道->vip1代理->vip2，vip1导入渠道商部分规格,vip2查看vip1的商品详情");
		try {
			// 发布商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV2(vipRootUserId,
					vipRootUserName, 5, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			// vip1导入渠道商商品
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			// 导入部分规格
			importAgentProductBean.getCatalogList().remove(0);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			// vip1查看vip渠道商品详情
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipAgentUserId1,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			System.out.println("-----" + productDetailsDto.toString());
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalogV2(productDetailsDto, productdetailsBean);

			// vip1查看导入的商品详情
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					agentProductId, false);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product1 = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto1 = (ProductDetailsDto) FormatUtil.GSONToObject(product1,
					ProductDetailsDto.class);
			productDetailsDto1.setStatus(0);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto1);
			verifyRootCatalog(productDetailsDto1, true);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_09() {
		Logger.start(true, "vip渠道->vip1代理->vip2，渠道商库存紧张，获取vip1和vip2商品详情");
		try {
			// 发布商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV2(vipRootUserId,
					vipRootUserName, 5, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			ymtCatalogsIWapper.updatestocknumByProductID(4, productId);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipAgentUserId1,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalogV2(productDetailsDto, productdetailsBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId2,
					agentProductId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product1 = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto1 = (ProductDetailsDto) FormatUtil.GSONToObject(product1,
					ProductDetailsDto.class);
			productDetailsDto1.setStatus(0);
			productDetailsDto1.setStatus(0);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto1);
			verifyRootCatalogV2(productDetailsDto1, productdetailsBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_10() {
		Logger.start(true, "获取商品详情，没有当前商品信息");
		try {
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, 0, "11", true);
			productdetailsBean.setMchId(csId1);
			productdetailsBean.setUserId(vipRootUserId);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("201", productdetailsCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_013() {
		Logger.start(true, "vip渠道,渠道商获取信息待完善商品，获取商品详情");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV2(vipRootUserId,
					vipRootUserName, 5, true);
			addAgentProductBean.setSaleType(2);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipRootUserId,
					productId, true);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_014() {
		Logger.start(true, "vip渠道->vip1,vip渠道修改代理价，vip1获取被动待完善商品");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ModifyAgentProductBean modifyAgentProductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);
			double price = 500.00;
			modifyAgentProductBean.getCatalogList().forEach(x -> {
				x.getAgentPriceList().forEach(p -> {
					p.setAgentPrice(price);
				});
			});
			AddAgentProductCallService.modifyAgentProduct(modifyAgentProductBean);

			Thread.sleep(2000);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					agentProductId, true);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, true);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_015() {
		Logger.start(true, "vip渠道->vip1,vip渠道修改代理价，vip1获取被动待完善商品");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ModifyAgentProductBean modifyAgentProductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);
			double price = 500.00;
			modifyAgentProductBean.getCatalogList().get(0).getAgentPriceList().forEach(p -> {
				p.setAgentPrice(price);
			});
			AddAgentProductCallService.modifyAgentProduct(modifyAgentProductBean);

			Thread.sleep(2000);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					agentProductId, true);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, true);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ProductDetails_016() {
		Logger.start(true, "渠道商客服获取自采商品详情,templateId4,成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			int csid = 500023286;
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, csid, productId, true);
			ProductDetailsCallV2 productDetailsCallV2 = new ProductDetailsCallV2();

			productDetailsCallV2.setData(productdetailsBean);
			productDetailsCallV2.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D76799A6A0A7DFE5EABBBFADB332C40F560517F6D23115912D2A9D66752A159D46C5EF288EA2ACD7155EE0F7923987B3F24F5");
			productDetailsCallV2.callService();
			String product = productDetailsCallV2.getJsonObject().toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_017() {
		Logger.start(true, "渠道商客服获取自采商品详情,templateId3,成功,不显示代理价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			int csid = 500023287;
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, csid, productId, true);
			ProductDetailsCallV2 productDetailsCallV2 = new ProductDetailsCallV2();

			productDetailsCallV2.setData(productdetailsBean);
			productDetailsCallV2.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D7679B8B5287DA8F6C358B032C5D4BF69995D777F8750D5FABCF6A03EBC4B67F0B3347F243B92D24DC8EAB34A7E1D0816E1CA");
			productDetailsCallV2.callService();
			String product = productDetailsCallV2.getJsonObject().toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(true, productDetailsDto.getAgentPriceList() == null, "验证会会数据没有代理价");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_018() {
		Logger.start(true, "渠道商客服获取自采商品详情,templateId2,成功,不显示代理价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			int csid = 500023288;
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, csid, productId, true);
			ProductDetailsCallV2 productDetailsCallV2 = new ProductDetailsCallV2();

			productDetailsCallV2.setData(productdetailsBean);
			productDetailsCallV2.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D767954A3F01B09D21A20479176177E62025B342BD096EA5F576089601F8445F4D7D4D699DCA8A26A1614D518EDA2019F0532");
			productDetailsCallV2.callService();
			String product = productDetailsCallV2.getJsonObject().toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(true, productDetailsDto.getAgentPriceList() == null, "验证会会数据没有代理价");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_019() {
		Logger.start(true, "渠道商客服获取自采商品详情,templateId1,成功,不显示代理价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			int csid = 500023289;
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, csid, productId, true);
			ProductDetailsCallV2 productDetailsCallV2 = new ProductDetailsCallV2();

			productDetailsCallV2.setData(productdetailsBean);
			productDetailsCallV2.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D767915F5F242E8D33853E112C14B8904A6AE559730333EF9D3573D244B59588F70E2BE7FDEE32326B219044BC1E17CF19372");
			productDetailsCallV2.callService();
			String product = productDetailsCallV2.getJsonObject().toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(true, productDetailsDto.getAgentPriceList() == null, "验证会会数据没有代理价");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_020() {
		Logger.start(true, "代理商客服获取渠道商商品详情,templateId1,成功,不显示代理价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			int csid = 500023293;
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, csid, productId, true);
			ProductDetailsCallV2 productDetailsCallV2 = new ProductDetailsCallV2();

			productDetailsCallV2.setData(productdetailsBean);
			productDetailsCallV2.addHeader("ymt-pars",
					"accesstoken=C9A0F08445A586D5B95F7676C601DC3E527B578341421000942D7F2940AD7D4A517D5FF6A1A868716147BFA77BB97DD3AAA1D31249D24DB4");
			productDetailsCallV2.callService();
			String product = productDetailsCallV2.getJsonObject().toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(true, productDetailsDto.getAgentPriceList() == null, "验证会会数据没有代理价");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ProductDetails_021() {
		Logger.start(true, "代理商客服获取渠道商商品详情,templateId4,成功,显示代理价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			int csid = 500023290;
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, csid, productId, true);
			ProductDetailsCallV2 productDetailsCallV2 = new ProductDetailsCallV2();

			productDetailsCallV2.setData(productdetailsBean);
			productDetailsCallV2.addHeader("ymt-pars",
					"accesstoken=C9A0F08445A586D56BB40E116BDBFA32847E62C5983F2A9ABCFF458A8AF7394F4DCC711806E44D8EFBC3F061D41098EAD8F3C2894EBD0888");
			productDetailsCallV2.callService();
			String product = productDetailsCallV2.getJsonObject().toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(false, productDetailsDto.getAgentPriceList() == null, "验证会会数据没有代理价");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ProductDetails_022() {
		Logger.start(true, "代理商客服获取代理商商品详情,templateId4,成功,显示代理价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, agentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			int csid = 500023290;
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, csid, agentProductId,
					true);
			ProductDetailsCallV2 productDetailsCallV2 = new ProductDetailsCallV2();

			productDetailsCallV2.setData(productdetailsBean);
			productDetailsCallV2.addHeader("ymt-pars",
					"accesstoken=C9A0F08445A586D56BB40E116BDBFA32847E62C5983F2A9ABCFF458A8AF7394F4DCC711806E44D8EFBC3F061D41098EAD8F3C2894EBD0888");
			productDetailsCallV2.callService();
			String product = productDetailsCallV2.getJsonObject().toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(false, productDetailsDto.getAgentPriceList() == null, "验证会会数据没有代理价");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_ProductDetails_023() {
		Logger.start(true, "代理商客服获取代理商商品详情,templateId3,成功,不显示代理价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, agentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			int csid = 500023290;
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, csid, agentProductId,
					true);
			ProductDetailsCallV2 productDetailsCallV2 = new ProductDetailsCallV2();

			productDetailsCallV2.setData(productdetailsBean);
			productDetailsCallV2.addHeader("ymt-pars",
					"accesstoken=C9A0F08445A586D56BB40E116BDBFA32847E62C5983F2A9ABCFF458A8AF7394F4DCC711806E44D8EFBC3F061D41098EAD8F3C2894EBD0888");
			productDetailsCallV2.callService();
			String product = productDetailsCallV2.getJsonObject().toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(false, productDetailsDto.getAgentPriceList() == null, "验证会会数据没有代理价");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_024() {
		Logger.start(true, "渠道商发布商品带运费模板，查看渠道商商品详情");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);

			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 1, 2);

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(createmchBean.getMchId(),
					createmchBean.getMchId(), productId, true);

			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			String product = productdetailsCall.getJsonObject().get("data").toString();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");

			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_0111() {
		Logger.start(true, "普通代理查看上级渠道商商品，渠道商没有设置代理价,获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, agentUserId1, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalogV3(productDetailsDto);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_0112() {
		Logger.start(true, "vip渠道->vip1->vip2，vip1没有设置代理价,vip2查看vip1,获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId2,
					agentProductId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();

			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalogV3(productDetailsDto);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_0113() {
		Logger.start(true, "vip渠道->vip1，vip渠道没有设置代理价,vip1查看vip1，获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					agentProductId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();

			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalogV4(productDetailsDto);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_0115() {
		Logger.start(true, "vip渠道->vip1->vip2，vip1没有设置代理价,vip2查看vip2，获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId2, vipAgentUserId2,
					agentProductId1, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();

			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId1, productDetailsDto);
			verifyRootCatalogV4(productDetailsDto);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_0116() {
		Logger.start(true, "vip渠道->vip1->vip2，vip渠道关闭代理,vip1查看vip1，获取成功");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);

			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ModifyAgentProductBean modifyagentproductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);
			modifyagentproductBean.setSetAgentPrice(false);
			AddAgentProductCallService.modifyAgentProduct(modifyagentproductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					agentProductId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();

			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId, productDetailsDto);
			verifyRootCatalogV4(productDetailsDto);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_0117() {
		Logger.start(true, "vip渠道->vip1->vip2，vip1关闭代理,vip2查看vip2，获取成功");
		try {
			// vip渠道
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);

			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip代理1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);

			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip代理2
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);

			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			ModifyAgentProductBean modifyagentproductBean = AddAgentProductCallService
					.initModifyAgentProductBeanByImportant(productId, importAgentProductBean);
			modifyagentproductBean.setSetAgentPrice(false);
			AddAgentProductCallService.modifyAgentProduct(modifyagentproductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId2, vipAgentUserId2,
					agentProductId1, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();

			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(agentProductId1, productDetailsDto);
			verifyRootCatalogV4(productDetailsDto);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_0118() {
		Logger.start(true, "渠道商查看自己的包税商品，获取成功");
		try {
			int userId = AgentUsers.vipRootUserId;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, "韩国免税店",
					true);
			addAgentProductBean.setTariffRate(0);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(userId, userId, productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_030() {
		Logger.start(true, "vip渠道->vip1->vip2,  vip2和vip1修改sku，skv没有变化");
		try {
			// 渠道商新建商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			int rootsku1 = Integer.parseInt(addAgentProductBean.getCatalogList().get(0).getSku());
			int rootsku2 = Integer.parseInt(addAgentProductBean.getCatalogList().get(1).getSku());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			// vip1代理渠道商
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// VIP2代理vip1
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);
			
			
			// 查询渠道商
			productdetailsBean.setProductId(productId);
			productdetailsBean.setUserId(vipRootUserId);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			int sku1 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList")
					.get(0).getAsJsonObject().get("sku").getAsInt();
			int sku2 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList")
					.get(1).getAsJsonObject().get("sku").getAsInt();
			Logger.verifyEquals(rootsku1, sku1, "验证渠道商sku1是否被修改");
			Logger.verifyEquals(rootsku2, sku2, "验证渠道商sku2是否被修改");

			// 修改vip1的sku查询vip1
			ModifyAgentProductBean mpb = AddAgentProductCallService
					.initModifyAgentProductBeanByImportant(agentProductId, importAgentProductBean);
			mpb.getCatalogList().get(0).setSku("666666");
			AddAgentProductCallService.modifyAgentProduct(mpb);
			productdetailsBean.setProductId(agentProductId);
			productdetailsBean.setUserId(vipAgentUserId1);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			sku1 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList").get(0)
					.getAsJsonObject().get("sku").getAsInt();
			sku2 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList").get(1)
					.getAsJsonObject().get("sku").getAsInt();
			Logger.verifyEquals(rootsku1, sku1, "验证vip1sku1是否被修改");
			Logger.verifyEquals(rootsku2, sku2, "验证vip1sku2是否被修改");

			// 修改vip2的sku，查询vip2
			ModifyAgentProductBean mpb1 = AddAgentProductCallService
					.initModifyAgentProductBeanByImportant(agentProductId1, importAgentProductBean1);
			mpb1.getCatalogList().get(0).setSku("888888");
			AddAgentProductCallService.modifyAgentProduct(mpb1);
			productdetailsBean.setProductId(agentProductId1);
			productdetailsBean.setUserId(vipAgentUserId2);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			sku1 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList").get(0)
					.getAsJsonObject().get("sku").getAsInt();
			sku2 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList").get(1)
					.getAsJsonObject().get("sku").getAsInt();
			Logger.verifyEquals(rootsku1, sku1, "验证vip2sku是否被修改");
			Logger.verifyEquals(rootsku2, sku2, "验证vip2sku是否被修改");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_031() {
		Logger.start(true, "vip渠道->vip1->vip2, 渠道商修改sku，vip1与vip2同步");
		try {
			// 创建运费模板

			// 渠道商新建商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			
			int rootsku1 = Integer.parseInt(addAgentProductBean.getCatalogList().get(0).getSku());
			int rootsku2 = Integer.parseInt(addAgentProductBean.getCatalogList().get(1).getSku());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			// vip1代理渠道商
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// VIP2代理vip1
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			// 修改渠道商的sku，查询渠道商
			ModifyAgentProductBean mpb = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			rootsku1 = 777777;
			rootsku2 = 777777;
			mpb.getCatalogList().get(0).setSku("" + rootsku1);
			mpb.getCatalogList().get(1).setSku("" + rootsku2);
			AddAgentProductCallService.modifyAgentProduct(mpb);
			productdetailsBean.setProductId(productId);
			productdetailsBean.setUserId(vipRootUserId);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			int sku1 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList")
					.get(0).getAsJsonObject().get("sku").getAsInt();
			int sku2 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList")
					.get(1).getAsJsonObject().get("sku").getAsInt();
			Logger.verifyEquals(rootsku1, sku1, "验证渠道商sku1是否被修改");
			Logger.verifyEquals(rootsku2, sku2, "验证渠道商sku2是否被修改");

			// 查询vip1
			productdetailsBean.setProductId(agentProductId);
			productdetailsBean.setUserId(vipAgentUserId1);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			sku1 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList").get(0)
					.getAsJsonObject().get("sku").getAsInt();
			sku2 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList").get(1)
					.getAsJsonObject().get("sku").getAsInt();
			Logger.verifyEquals(rootsku1, sku1, "验证vip1sku1是否被修改");
			Logger.verifyEquals(rootsku2, sku2, "验证vip1sku2是否被修改");

			// 查询vip2
			productdetailsBean.setProductId(agentProductId1);
			productdetailsBean.setUserId(vipAgentUserId2);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			sku1 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList").get(0)
					.getAsJsonObject().get("sku").getAsInt();
			sku2 = productdetailsCall.getJsonObject().get("data").getAsJsonObject().getAsJsonArray("catalogList").get(1)
					.getAsJsonObject().get("sku").getAsInt();
			Logger.verifyEquals(rootsku1, sku1, "验证vip2sku1是否被修改");
			Logger.verifyEquals(rootsku2, sku2, "验证vip2sku1是否被修改");

			// 查询es
			ESsearchBean bean = new ESsearchBean();
			ESsearchCall call = new ESsearchCall();
			bean.setProductId("pid:" + productId);
			call.setData(bean);
			call.callService();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_032() {
		Logger.start(true, "普通代理查看上级渠道商商品视频,获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			System.out.println(addAgentProductBean.getVideo());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, agentUserId1, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(productDetailsDto.getVideo().toString(), addAgentProductBean.getVideo().toString(),
					"判断");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_033() {
		Logger.start(true, "普通代理查看上级渠道商刚刚修改过的商品视频,实时获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			System.out.println(addAgentProductBean.getVideo());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ModifyAgentProductBean mpb = AddAgentProductCallService.initModifyAgentProductBean(productId,
					addAgentProductBean);
			mpb.getVideo().setUrl("http://v2.ymatou.com/66666666.mp4");
			AddAgentProductCallService.modifyAgentProduct(mpb);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, agentUserId1, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			// Logger.verifyNotEquals(productDetailsDto.getVideo().toString(),
			// addAgentProductBean.getVideo().toString(), "判断");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	public static void main(String[] args) throws AWTException {
		Robot ro=new Robot();
		for (int i = 0; i < 10; i++) {
			
		}
		ro.mouseMove(853, 492);
		ro.mousePress(InputEvent.BUTTON1_MASK); //按下左键
		ro.mousePress(InputEvent.BUTTON1_MASK); //按下左键
//		ro.mousePress(InputEvent.BUTTON2_MASK); //按下滚轴键
//		ro.mousePress(InputEvent.BUTTON3_MASK); //按下右键
		
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_034() {
		Logger.start(true, "渠道商发布商品，下面自动继承的代理自动继承,判断进货价是否正确");
		try {
			// 创建两个用户
			UserCreateBean usercreateBean1 = DGUserCallService.initUsercreateBean();
			UserCreateBean usercreateBean2 = usercreateBean1;
			int userId_channl = DGUserCallService.UserCreateCall(usercreateBean1);
			usercreateBean1 = DGUserCallService.initUsercreateBean();
			int userId_agent = DGUserCallService.UserCreateCall(usercreateBean1);
			// 设置渠道商
			createmchBean createmchbean = GodmchManageCallService.InitcreatemchBeanForChannel(userId_channl);
			GodmchManageCallService.createmchCallForChannel(createmchbean);
			// 渠道商创建一个邀请码，出来一个自动继承的代理商、自动继承渠道商刚才的商品
			CreateCodeBean createbean = GodmchManageCallService.InitcreateCodeBeanForAgent(userId_channl);
			createbean.setAgentModel(2);// 自动继承
			CreateCodeCall CreateCodeCall = GodmchManageCallService.createCodeCall(createbean);
			List<createmchBean> createmchList = GodmchManageCallService.InitcreatemchBeanForAgent(userId_channl,
					userId_agent); //
			createmchList.get(0).setCode(CreateCodeCall.getCode());
			GodmchManageCallService
					.createmchCallForAgent(createmchList.toArray(new createmchBean[createmchList.size()]));

			// 给渠道商创建一个商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,
					usercreateBean2.getNickname(), true);
			double price = 200;
			addAgentProductBean.getCatalogList().forEach(a -> {
				a.setDirectPrice(price * 2);
				a.getAgentPriceList().forEach(b -> {
					b.setAgentPrice(price);
				});
			});
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);

			// 渠道商查询
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(userId_channl, userId_channl,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);

			// 代理商查询
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(userId_channl, userId_agent,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product1 = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto1 = (ProductDetailsDto) FormatUtil.GSONToObject(product1,
					ProductDetailsDto.class);
			productDetailsDto.getCatalogList().forEach(a -> {
				Logger.verifyEquals(price * 2, a.getDirectPrice(), "判断直销价--渠道商");
				Logger.verifyEquals(0.0, a.getAgentPrice(), "判断提货价--渠道商");
			});
			productDetailsDto1.getCatalogList().forEach(a -> {
				Logger.verifyEquals(price * 2, a.getDirectPrice(), "判断直销价--代理商");
				Logger.verifyEquals(price, a.getAgentPrice(), "判断提货价--代理商");
			});

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_035() {
		Logger.start(true, "代理水印开--非继承性代理查询水印");
		try {

			int userId_channl = 500275675;
			int userId_agent = 500275676;
			AddAgentProductBean sellerProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,
					"666666", true);
			// 提交发布商品
			String f1 = System.getProperty("user.dir") + File.separator + "resource" + File.separator + "Penguins.jpg";
			FontImage.addWaterMark(f1, f1, Arrays.asList("测试" + TestDataManager.getRandomNum(2)),
					new Font("blod", 1, 20), Color.BLACK,"png");
			String picUrl = TestDataManager.UploadFile(f1);
			sellerProductBean.getPics().set(2, picUrl);
			String productId = AddAgentProductCallService.AddAgentProduct(sellerProductBean);
			Thread.sleep(5000);
			
			ImportAgentProductBean AgentProductBean = AddAgentProductCallService.initImportAgentProduct(userId_agent,
					"777777", productId, userId_channl, false);
			String productId1 = AddAgentProductCallService.ImportAgentProduct(AgentProductBean);

			Thread.sleep(5000);

			// 渠道商查询
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(userId_channl, userId_channl,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);

			// 代理商查询
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(userId_channl, userId_agent,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product1 = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto1 = (ProductDetailsDto) FormatUtil.GSONToObject(product1,
					ProductDetailsDto.class);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_036() {
		Logger.start(true, "代理水印关--非继承性代理查询水印");
		try {

			int userId_channl = 500275675;
			int userId_agent = 500275676;
			AddAgentProductBean sellerProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,
					"666666", true);
			// 提交发布商品
			String productId = AddAgentProductCallService.AddAgentProduct(sellerProductBean);
			Thread.sleep(5000);

			ImportAgentProductBean AgentProductBean = AddAgentProductCallService.initImportAgentProduct(userId_agent,
					"777777", productId, userId_channl, false);

			String productId1 = AddAgentProductCallService.ImportAgentProduct(AgentProductBean);

			Thread.sleep(5000);

			// 渠道商查询
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(userId_channl, userId_channl,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);

			// 代理商查询
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(userId_channl, userId_agent,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product1 = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto1 = (ProductDetailsDto) FormatUtil.GSONToObject(product1,
					ProductDetailsDto.class);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_037() {
		Logger.start(true, "渠道商查询自己的商品详情，判断虚拟库存");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			addAgentProductBean.getCatalogList().get(0).setVirtualStock(30);
			addAgentProductBean.getCatalogList().get(0).setStock(40);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, rootUserId, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
			ProductDetailsDto productDetails = productdetailsCall.getProductDetails();

			// 判断虚拟库存真实库存
			Logger.verifyEquals(70, productDetails.getCatalogList().get(0).getStock(), "总库存查询");
			Logger.verifyEquals(40, productDetails.getCatalogList().get(0).getRealStock(), "真实库存查询");
			Logger.verifyEquals(30, productDetails.getCatalogList().get(0).getVirtualStock(), "虚拟库存查询");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_038() {
		Logger.start(true, "代理商查询导入的商品详情，真实库存5，虚拟库存6  5+6>11  库存充足");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.getCatalogList().get(0).setVirtualStock(6);
			addAgentProductBean.getCatalogList().get(0).setStock(5);
			String RootproductId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, RootproductId, vipRootUserId, false);
			String productId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipAgentUserId1,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			ProductDetailsDto productDetails = productdetailsCall.getProductDetails();

			// 判断虚拟库存真实库存
			Logger.verifyEquals("库存充足", productDetails.getCatalogList().get(0).getStockInfo(), "总库存查询");
			// Logger.verifyEquals(40,productDetails.getCatalogList().get(0).getRealStock(),
			// "真实库存查询");
			// Logger.verifyEquals(30,productDetails.getCatalogList().get(0).getVirtualStock(),
			// "虚拟库存查询");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_039() {
		Logger.start(true, "代理商查询导入的商品详情，真实库存5，虚拟库存3  5+3<10  库存紧张");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.getCatalogList().get(0).setVirtualStock(3);
			addAgentProductBean.getCatalogList().get(0).setStock(5);
			String RootproductId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, RootproductId, vipRootUserId, false);
			String productId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipAgentUserId1,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			ProductDetailsDto productDetails = productdetailsCall.getProductDetails();

			// 判断虚拟库存真实库存
			Logger.verifyEquals("库存紧张(不足10件)", productDetails.getCatalogList().get(0).getStockInfo(), "总库存查询");
			// Logger.verifyEquals(40,productDetails.getCatalogList().get(0).getRealStock(),
			// "真实库存查询");
			// Logger.verifyEquals(30,productDetails.getCatalogList().get(0).getVirtualStock(),
			// "虚拟库存查询");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_040() {
		Logger.start(true, "普通代理查看上级渠道商商品，当渠道已经解除时，获取失败");
		try {
			// 创建两个用户
			UserCreateBean usercreateBean1 = DGUserCallService.initUsercreateBean();
			int userId_channl = DGUserCallService.UserCreateCall(usercreateBean1);
			usercreateBean1 = DGUserCallService.initUsercreateBean();
			int userId_agent = DGUserCallService.UserCreateCall(usercreateBean1);
			// 设置渠道商
			createmchBean createmchbean = GodmchManageCallService.InitcreatemchBeanForChannel(userId_channl);
			GodmchManageCallService.createmchCallForChannel(createmchbean);
			// 渠道商创建一个邀请码，出来一个自动继承的代理商、自动继承渠道商刚才的商品
			CreateCodeBean createbean = GodmchManageCallService.InitcreateCodeBeanForAgent(userId_channl);
			createbean.setAgentModel(1);// 自动继承
			CreateCodeCall CreateCodeCall = GodmchManageCallService.createCodeCall(createbean);
			List<createmchBean> createmchList = GodmchManageCallService.InitcreatemchBeanForAgent(userId_channl,
					userId_agent); //
			createmchList.get(0).setCode(CreateCodeCall.getCode());
			GodmchManageCallService
					.createmchCallForAgent(createmchList.toArray(new createmchBean[createmchList.size()]));

			// 给渠道商创建一个商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,
					usercreateBean1.getNickname(), true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 代理商导入
			ImportAgentProductBean initImportAgentProduct = AddAgentProductCallService.initImportAgentProduct(
					userId_agent, usercreateBean1.getNickname(), productId, userId_channl, false);
			String productId1 = AddAgentProductCallService.ImportAgentProduct(initImportAgentProduct);

			GodmchManageCallService.InitremovemchForAgent(userId_channl, userId_agent);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(userId_channl, userId_agent,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("201", productdetailsCall.getString("code"), "验证code");
			Logger.verifyIsContains("代理关系不存在", productdetailsCall.getString("message"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_041() {
		Logger.start(true, "渠道商查看自己的商品详情，查看市场价。获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(100.00);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, rootUserId, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(100.00, productDetailsDto.getCatalogList().get(0).getMarketAmount(), "验证市场价");
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_042() {
		Logger.start(true, "代理商查看自己的商品详情，查看自动加价标志");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, rootUserId, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(productDetailsDto.getAutoMarkupStatus(), -1, "没有自动加价标志");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}


	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_044() {
		Logger.start(true, "代理商查看自己的商品详情，有配送方式标志");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.setCollectionGoods(false);
			addAgentProductBean.setMinOrderNum(100);
			String RootproductId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, RootproductId, vipRootUserId, false);
			String productId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					productId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			JsonObject data = productdetailsCall.getJsonObject().getAsJsonObject("data");
			Logger.verifyEquals(data.get("expressDelivery").getAsBoolean(), true, "验证快递配送方式字段");
			Logger.verifyEquals(data.get("collectionGoods").getAsBoolean(), false, "验证自提配送方式字段");
			Logger.verifyEquals(data.get("minOrderNum").getAsInt(), 100, "验证最小起购数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_045() {
		Logger.start(true, "渠道商查看自己的商品详情，有配送方式标志");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.setCollectionGoods(false);
			addAgentProductBean.setMinOrderNum(100);
			String RootproductId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipRootUserId,
					RootproductId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			JsonObject data = productdetailsCall.getJsonObject().getAsJsonObject("data");
			Logger.verifyEquals(data.get("expressDelivery").getAsBoolean(), true, "验证配送方式字段");
			Logger.verifyEquals(data.get("collectionGoods").getAsBoolean(), false, "验证配送方式字段");
			Logger.verifyEquals(data.get("minOrderNum").getAsInt(), 100, "验证最小起购数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_046() {
		Logger.start(true, "渠道商查看自己的商品详情，当商品开关与是商户开关都开启时，自提开关开启");
		try {
			int rootUserId = 501465799;

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId, "",
					true);
			addAgentProductBean.setCollectionGoods(true);
			addAgentProductBean.setExpressDelivery(true);
			String RootproductId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, rootUserId, RootproductId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			JsonObject data = productdetailsCall.getJsonObject().getAsJsonObject("data");
			Logger.verifyEquals(data.get("expressDelivery").getAsBoolean(), true, "验证快递配送方式字段");
			Logger.verifyEquals(data.get("collectionGoods").getAsBoolean(), true, "验证自提配送方式字段");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_047() {
		Logger.start(true, "渠道商查看自己的商品详情，当商品开关开区，商户开关关闭时，自提开关关闭");
		try {

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.setCollectionGoods(true);
			addAgentProductBean.setExpressDelivery(true);
			String RootproductId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipRootUserId, vipRootUserId,
					RootproductId, true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			JsonObject data = productdetailsCall.getJsonObject().getAsJsonObject("data");
			Logger.verifyEquals(data.get("expressDelivery").getAsBoolean(), true, "验证快递配送方式字段");
			Logger.verifyEquals(data.get("collectionGoods").getAsBoolean(), false, "验证自提配送方式字段");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_048() {
		Logger.start(true, "Vip二级代理查看自己商品，有自动加价标志");
		try {

			int vipRootUserId = 500781768;
			int vipAgentUserId = 500781769;
			int vipAgentUserId1 = 500781770;

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId, "",
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			// 查到代理商的商品id
			List<AgentProductPo> ap = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == vipAgentUserId)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap));

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId, vipAgentUserId,
					ap.get(0).getProductId(), true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();

			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);

			Logger.verifyEquals(productDetailsDto.getAutoMarkupStatus(), 1, "有自动加价标志");

			// 查到二级代理商的商品id
			List<AgentProductPo> ap1 = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == vipAgentUserId1)
					.collect(Collectors.toList());
			Logger.debug("ap:" + FormatUtil.beanToGSONString(ap1));

			productdetailsBean = AddAgentProductCallService.initGetProductDetails(vipAgentUserId1, vipAgentUserId1,
					ap1.get(0).getProductId(), true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();

			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product1 = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto1 = (ProductDetailsDto) FormatUtil.GSONToObject(product1,
					ProductDetailsDto.class);

			Logger.verifyEquals(productDetailsDto1.getAutoMarkupStatus(), 1, "有自动加价标志");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_049() {
		Logger.start(true, "渠道商查看自己的商品详情，查看仓库。获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			createDepotBean bean=GodmchManageCallService.createDepot(rootUserId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(rootUserId, rootUserId, productId,
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			
			Logger.verifyEquals(productDetailsDto.getDepotId(),selectDepotByDepotTitle.get(0).getDepotId(), "验证depotId");
			Logger.verifyEquals(productDetailsDto.getDepotTitle(),selectDepotByDepotTitle.get(0).getDepotTitle(), "验证depotTitle");
			AgentProductCallService.checkProductDetail(productId, productDetailsDto);
			verifyRootCatalog(productDetailsDto, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_050() {
		Logger.start(true, "分销小店查看利润，代理类型，代理价");
		try {
			int userId = 500945639;
			int AgentUserId = 500945640;
			// 给渠道商创建一个商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, "", false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(userId,
					AgentUserId, productId, true);
			ProductDetailsDto selectProductDetails = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails);
			List<String> catalogs = new ArrayList<>();
			selectProductDetails.getCatalogList().forEach(c -> {
				catalogs.add(c.getCatalogId());
			});
			
			ProductDetailsBean initGetProductDetails1 = AddAgentProductCallService.initGetProductDetails(userId,
					AgentUserId, productId, true);
			ProductDetailsDto selectProductDetails1 = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails1);
			
			Logger.verifyEquals(selectProductDetails1.getCatalogList().get(0).getAgentPrice(), 2.0, "分佣比例");
			Logger.verifyEquals(selectProductDetails1.getCatalogList().get(0).getAgentPriceType(), 1, "按比例分佣");
			Logger.verifyEquals(selectProductDetails1.getCatalogList().get(0).getProfit(), selectProductDetails1.getCatalogList().get(0).getDirectPrice()*0.02, "利润=销售价*分佣");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_051() {
		Logger.start(true, "渠道商--代理--分销小店查看利润，代理类型，代理价");
		try {
			int userId = 500949763;
			int AgentUserId = 500949764;
			int AgentUserId1 = 500949765;
			// 给渠道商创建一个商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, "", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(AgentUserId,"",productId,userId,false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			Thread.sleep(5000);
			ProductDetailsBean initGetProductDetails1 = AddAgentProductCallService.initGetProductDetails(userId,
					AgentUserId1, agentProductId, true);
			ProductDetailsDto selectProductDetails1 = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails1);
			
			Logger.verifyEquals(selectProductDetails1.getCatalogList().get(0).getAgentPrice(), 30.0,"分佣比例");
			Logger.verifyEquals(selectProductDetails1.getCatalogList().get(0).getAgentPriceType(), 1, "按比例分佣");
			Logger.verifyEquals(selectProductDetails1.getCatalogList().get(0).getProfit(), selectProductDetails1.getCatalogList().get(0).getDirectPrice()*0.3, "利润=销售价*分佣");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_052() {
		Logger.start(true, "查询条码");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			ProductDetailsBean initGetProductDetails1 = AddAgentProductCallService.initGetProductDetails(rootUserId,
					rootUserId, productId, true);
			ProductDetailsDto selectProductDetails1 = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails1);
			Logger.verifyEquals(selectProductDetails1.getCatalogList().get(0).getBarcode(), barCodes.get(0), "验证条形码");
			Logger.verifyEquals(selectProductDetails1.getCatalogList().get(1).getBarcode(), barCodes.get(1), "验证条形码");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_053() {
		Logger.start(true, "查询条码");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			String productParam="{'啊啊':'哈哈'}";
			addAgentProductBean.setProductParam(productParam);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			
			ProductDetailsBean initGetProductDetails1 = AddAgentProductCallService.initGetProductDetails(rootUserId,
					rootUserId, productId, true);
			ProductDetailsDto selectProductDetails1 = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails1);
			
			Logger.verifyEquals(productParam,selectProductDetails1.getProductParam(),  "验证productParam");
		} catch (Exception e) {
			Logger.fail(e);
		}
		
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_054() {
		Logger.start(true, "查询买家手续费");
		try {
			int rootUserId=501150255;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			
			ProductDetailsBean initGetProductDetails1 = AddAgentProductCallService.initGetProductDetails(rootUserId,
					rootUserId, productId, true);
			ProductDetailsDto selectProductDetails1 = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails1);
			Logger.verifyEquals(15.00,selectProductDetails1.getBuyerServiceRate().doubleValue(),"验证手续费");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_055() {
		Logger.start(true, "渠道商发布商品，下面自动铺货的代理，自动铺货，验证自动铺货");
		try {
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);
            
            createDepotBean bean=GodmchManageCallService.createDepot(mchId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
            setConditionMarkupConfigBean setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(agent_mchId, mchId, 1, addAgentProductBean, 1);
            setConditionMarkupConfigBean.setRefreshProduct(true);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			Thread.sleep(5000);
			List<ProductListDto> getProductLists = AddAgentProductCallService.GetProductLists(mchId);
			Logger.verifyEquals(1, getProductLists.size(), "验证上架商品");
			List<ProductListDto> getProductLists1 = AddAgentProductCallService.GetProductLists(agent_mchId);
			Logger.verifyEquals(1, getProductLists1.size(), "验证上架商品");
			
			List<ProductCatalogListDto> catalogList = getProductLists1.get(0).getCatalogList();
			Logger.verifyEquals(catalogList.get(0).getDirectPrice().intValue(), (int) Math.round(catalogList.get(0).getAgentPrice()*1.01), "验证价格是否正确");
			Logger.verifyEquals(catalogList.get(1).getDirectPrice().intValue(), (int) Math.round(catalogList.get(1).getAgentPrice()*1.01), "验证价格是否正确");
			
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(agent_mchId,
					agent_mchId, getProductLists1.get(0).getProductId(), true);
			ProductDetailsDto selectProductDetails = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails);
			Logger.verifyEquals(1, selectProductDetails.getAutoMarkupStatus(), "验证自动加价配置");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_056() {
		Logger.start(true, "渠道商发布商品，代理商导入，然后设置自动铺货，查询刷价格");
		try {
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);
            
            createDepotBean bean=GodmchManageCallService.createDepot(mchId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
            
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agent_mchId,"",productId,mchId,false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			Thread.sleep(5000);
			setConditionMarkupConfigBean setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(agent_mchId, mchId, 1, addAgentProductBean, 1);
			setConditionMarkupConfigBean.setRefreshProduct(true);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
            
			Thread.sleep(5000);
			
			List<ProductListDto> getProductLists = AddAgentProductCallService.GetProductLists(mchId);
			Logger.verifyEquals(1, getProductLists.size(), "验证上架商品");
			List<ProductListDto> getProductLists1 = AddAgentProductCallService.GetProductLists(agent_mchId);
			Logger.verifyEquals(1, getProductLists1.size(), "验证上架商品");
			List<ProductCatalogListDto> catalogList = getProductLists1.get(0).getCatalogList();
			Logger.verifyEquals(catalogList.get(0).getDirectPrice().intValue(), (int) Math.round(catalogList.get(0).getAgentPrice()*1.01), "验证价格是否正确");
			Logger.verifyEquals(catalogList.get(1).getDirectPrice().intValue(), (int) Math.round(catalogList.get(1).getAgentPrice()*1.01), "验证价格是否正确");
			
			
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(agent_mchId,
					agent_mchId, agentProductId, true);
			ProductDetailsDto selectProductDetails = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails);
			Logger.verifyEquals(1, selectProductDetails.getAutoMarkupStatus(), "验证自动加价配置");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_057() {
		Logger.start(true, "商品详情，新增商品副标题，销售区域，自提点Id，7天无理由退货");
		try {
			Integer sellerId = GodmchManageCallService.CreateGodMch();
			CreateCollectionGoodsAddressBean initCreateCollectionGoodsAddressBean = GodfreightmgrService.initCreateCollectionGoodsAddressBean(sellerId);
			int createcoll = GodfreightmgrService.createcollectiongoodsaddressCall(initCreateCollectionGoodsAddressBean);
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					"", true);
			String subtitle="副标题"+TestDataManager.randomStr(10);
			addAgentProductBean.setSubTitle(subtitle);
			addAgentProductBean.setSaleArea(3);
			addAgentProductBean.setCollectionGoodsAddress(Arrays.asList(createcoll));
			addAgentProductBean.setNoReasonReturn(true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productId).get(0);
			AgentProductPo agentProductPo =  new YmtProductsIWapper().selectAgentProductByProductId(productId);
			
			Logger.verifyEquals(subtitle, agentProductPo.getSubTitle(), "验证SubTitle");
			Logger.verifyEquals(3, agentProductPo.getSaleArea(), "验证SaleArea");
			Logger.verifyEquals(createcoll+"", agentProductPo.getCollectionGoodsAddress(), "验证CollectionGoods");
			Logger.verifyEquals(true, ymtProductsI.getbNoReasonReturn(), "验证NoReasonReturn");
			
			ProductDetailsBean initGetProductDetails = AddAgentProductCallService.initGetProductDetails(sellerId,
					sellerId, productId, true);
			ProductDetailsDto ProductDetails = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails);
			
			Logger.verifyEquals(subtitle, ProductDetails.getSubTitle(), "验证SubTitle");
			Logger.verifyEquals(3, ProductDetails.getSaleArea(), "验证SaleArea");
			Logger.verifyEquals(initCreateCollectionGoodsAddressBean.getAddressName(), ProductDetails.getCollectionGoodsAddress().get(0), "验证CollectionGoods");
			Logger.verifyEquals(true, ProductDetails.getNoReasonReturn(), "验证NoReasonReturn");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_058() {
		Logger.start(true, "代理商查看自己的商品详情，查看代理价自动加价标志");
		try {
			//创建一个渠道商-》代理-》代理
			Integer MchId = GodmchManageCallService.CreateGodMch();
			GodmchManageCallService.SetVip(MchId);
			Integer AgentId = GodmchManageCallService.CreateAgent(MchId);
			Integer AgentId1 = GodmchManageCallService.CreateAgent(AgentId,MchId);
            
			//渠道商创建商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(MchId,
					"", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			//设置自动加价规则
			setConditionMarkupConfigBean setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(AgentId, MchId, 1, addAgentProductBean, 0);
            setConditionMarkupConfigBean.setRefreshProduct(true);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
            //设置自动加价规则
			setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(AgentId1, AgentId, 1, addAgentProductBean, 0);
            setConditionMarkupConfigBean.setRefreshProduct(true);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
            
            //设置代理价自动加价规则
			setAgentConditionMarkupConfigBean bean1 = GodmchManageCallService.initSetAgentConditionMarkupConfig(MchId,AgentId);
            setAgentConditionMarkupConfigCall call1 = GodmchManageCallService.setAgentConditionMarkupConfigCall(bean1);
            
            
            //设置代理价自动加价规则
            setAgentConditionMarkupConfigBean bean = GodmchManageCallService.initSetAgentConditionMarkupConfig(AgentId,AgentId1);
            setAgentConditionMarkupConfigCall call = GodmchManageCallService.setAgentConditionMarkupConfigCall(bean);
            
			
            Thread.sleep(5000);
            // 查询代理的
            List<AgentProductPo> ap = ymtProductsIWapper.selectAgentProductByRootProductId(productId).stream()
         					.filter(x -> x.getAction() == 0).filter(x -> x.getUserId() == AgentId)
         					.collect(Collectors.toList());
            Logger.debug("ap:" + FormatUtil.beanToGSONString(ap));
         			
			productdetailsBean = AddAgentProductCallService.initGetProductDetails(AgentId, AgentId, ap.get(0).getProductId(),
					true);
			productdetailsCall.setData(productdetailsBean);
			productdetailsCall.callService();
			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
			String product = productdetailsCall.getJsonObject().get("data").toString();
			ProductDetailsDto productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
					ProductDetailsDto.class);
			Logger.verifyEquals(productDetailsDto.getAgentPriceAutoMarkupStatus(),1, "没有自动加价标志");
			
			productDetailsDto.getAgentPriceList().forEach(b->{
				if(b.getAgentType()==bean.getPercentageList().get(0).getAgentTypeId()){
					b.getCatalogPriceList().forEach(c->{
						productDetailsDto.getCatalogList().forEach(d->{
							if(c.getCatalogId().equals(d.getCatalogId())){
								Logger.comment("验证"+d.getCatalogId()+"自动加价是否正确---到手代理价："+d.getAgentPrice()+"给下级代理价："+c.getAgentPrice());
								NumberFormat   nf=new  DecimalFormat( "0.0");
							    double dou = Double.parseDouble(nf.format(d.getAgentPrice()*(0.01*bean.getPercentageList().get(0).getPercentage().doubleValue()+1)));
								Logger.verifyEquals(dou, c.getAgentPrice(), "验证自动加价");
							}
						});
					});
				}
				
			});
			
//			productdetailsBean = AddAgentProductCallService.initGetProductDetails(agent_mchId, agent_mchId, productId1,
//					true);
//			productdetailsCall.setData(productdetailsBean);
//			productdetailsCall.callService();
//			Logger.verifyEquals("200", productdetailsCall.getString("code"), "验证code");
//			product = productdetailsCall.getJsonObject().get("data").toString();
//			productDetailsDto = (ProductDetailsDto) FormatUtil.GSONToObject(product,
//					ProductDetailsDto.class);
//			Logger.verifyEquals(productDetailsDto.getAutoMarkupStatus(), -1, "没有自动加价标志");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ProductDetails_059() {
		Logger.start(true, "商详查询规格套装");
		try {
			AddAgentProductBean Product1 = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			Product1.getCatalogList().remove(0);
			String productId1 = AddAgentProductCallService.AddAgentProduct(Product1);
			
			
			AddAgentProductBean Product2 = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			Product2.getCatalogList().remove(0);
			String productId2 = AddAgentProductCallService.AddAgentProduct(Product2);
			
			AddAgentProductBean addAgentProductBean=AddAgentProductCallService.initAddAgentProduct(sellerId,sellerName, true);
			
			
			
			addAgentProductBean.getCatalogList().remove(1);
			SubCatalogDto subCatalogDto = new SubCatalogDto();
			subCatalogDto.setSkuId(Product1.getCatalogList().get(0).getSku());
			subCatalogDto.setBarcode(Product1.getCatalogList().get(0).getBarcode());
			subCatalogDto.setSalePrice(Product1.getCatalogList().get(0).getDirectPrice());
			subCatalogDto.setNum(10);
			
			
			SubCatalogDto subCatalogDto1 = new SubCatalogDto();
			subCatalogDto1.setSkuId(Product2.getCatalogList().get(0).getSku());
			subCatalogDto1.setBarcode(Product2.getCatalogList().get(0).getBarcode());
			subCatalogDto1.setSalePrice(Product2.getCatalogList().get(0).getDirectPrice());
			subCatalogDto1.setNum(10);
			
			addAgentProductBean.setSubCatalogs(Arrays.asList(subCatalogDto,subCatalogDto1));
			
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(2000);
			ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(sellerId, productId);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	

}